<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理作品</title>
<script type="text/javascript" src="/skin/WDYYhtml/js/jquery.js"></script>
<script type="text/javascript" src="/skin/WDYYhtml/js/common.js"></script>
<script type="text/javascript" src="/include/manage/swfupload/swfupload.js"></script>
<script type="text/javascript" src="/include/manage/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="/include/manage/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="/skin/WDYYhtml/js/pic_handlers.js"></script>
<link rel="stylesheet" href="/skin/WDYYhtml/css/style.css" type="text/css" media="all" />
<script language="javascript">
var picnums=0;
/*
#set($pics=$user.getPicsByPicType($!thisPicType.id,-1))
#if($pics)
*/
picnums=$pics.size();
/*
#end
*/
var settings;

jQuery.ajaxSetup ({  
	cache: false
});

$(function(){
			//初始化上传组件
			settings = {
				flash_url : "/include/manage/swfupload/swfupload.swf",
				upload_url: "/ImageUpload?sid=$!thisSite.id&pid=$!thisPicType.id&uid=$!user.id",
				use_query_string : true,
				file_size_limit : "10 MB",
				file_types : "*.jpg;*.gif;*.bmp;*.png",
				file_types_description : "图片文件",
				file_upload_limit : 15,
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,
				// Button settings
				button_image_url: "/include/manage/swfupload/XPButtonUploadText_61x22.png",
				button_width: "61",
				button_height: "22",
				button_placeholder_id: "spanButtonPlaceHolder",
				
				moving_average_history_size: 40,
				
				// The event handler functions are defined in handlers.js
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings);

});

function showSpicSetting(){
	if($('#spicsetting')[0].style.display=='none'){
		$('#spicsetting')[0].style.display='';
		gen_spic=1;
	}else{
		$('#spicsetting')[0].style.display='none';
		gen_spic=0;
	}
}

function editPic(picurl){
	if(picurl.length>0){
		var host = window.location.hostname;
		var port = window.location.port;
		var domainName = "http://" + host;
		if(port != ""){
			domainName += ":" + port;
		}
		location.href='/picedit/MediaCreator.jsp?pic='+domainName+picurl;
	}
}

function updatePicOrder(picid,o){
	$(o).css({"color":"" ,"backgroundColor":""});
	$.get('/user.do',{parameter:'updatePicOrder',id:picid,order:$(o).val()},function(data){
	});
}

function delPic(id){
	if(confirm('确定要删除吗?')){
		$('#pids').val(id);
		$('#delform').submit();
	}
}

function showOrderEdit(o){
	$(o).css({"color":"black" ,"backgroundColor":"white"});
}

function checkForm(){
	if($('#ptname').val().length<=0){
		alert('标题必填！');
		$('#ptname')[0].focus();
		return false;
	}
	if(picnums<=0){
		alert('至少上传一张图片！');
		return false;
	}
	$('#editPicTypeForm').submit();
}
</script>
</head>

<body>
#parse('/inc/user_head.htm')
<form id="delform" name="delform" action="/user.do" method="post">
	<input type="hidden" name="parameter" value="delPic" />
	<input id="pids" type="hidden" name="id" />
</form>
<div id="Wrapper">
	<div class="wrapper mwrapper">
		<div class="mem">
			<div class="mmenu">
				<a href="/user.do?parameter=index">首页</a>
				<a class="active" href="/user.do?parameter=show">作品秀</a>
				<a href="/user.do?parameter=profile">个人资料</a>
				<a href="/user.do?parameter=editPassword">修改密码</a>
			</div>

			<div class="memshow">
				<div class="title">
					<h3>作品管理</h3>
					<a href="/user.do?parameter=addPicType">发布作品 &gt;&gt;</a>
				</div>
				
				<form id="editPicTypeForm" name="editPicTypeForm" action="/user.do" method="post">
				<input type="hidden" name="parameter" value="updatePicType"/>
                <input type="hidden" name="id" value="$!thisPicType.id"/>
                <input type="hidden" name="userid" value="$user.id"/>
                <input type="hidden" name="site" value="$thisSite.id"/>
				<div class="cont">
					<h5>发布作品，让更多的人了解你</h5>
					
					<div class="m1">
						<ul><li><strong>标题：</strong><input id="ptname" class="mtxt" type="text" value="$!thisPicType.name" name="name" /></li>
							<li><strong>时间：</strong><input class="mtxt mtxt1" type="text" value="$!thisPicType.date" name="date" /></li>
						</ul>
					</div>
					
					<!---->
					<div class="m2" id="thumbnails">
						
						#foreach($apic in $pics)
						<div class="m2c">
							<img src="$apic.url" alt="" />
							<ul><!--li><a href="javascript:edit('$apic.id')">更改/上传图片</a> (注：建议上传图片尺寸为670x600,格式为jpg或gif，宽度不得大于670)</li-->
								<li><a href="javascript:delPic('$!apic.id')">删除图片</a></li>
								<li><em>排序</em><input id="order_$!apic.id" class="mtxt mtxt2" value="$apic.order" name="order" onblur="updatePicOrder('$!apic.id',this)" onclick="showOrderEdit(this)" /></li>
							</ul>
						</div>
						#end

					</div>
					
					<div class="m3">
						<h6>上传图片</h6>
						<p class="legend">上传队列</p>
						<div class="m3c" id="fsUploadProgress">
						</div>
						<div id="divStatus">
							已上传 0 个图片
						</div>
						<p class="m3btn">
                        	<span id="spanButtonPlaceHolder"></span>
							<!--input id="dialog_link" type="button" class="fbtn" value="浏览..."/-->
							<!--label><input id="spic" name="spic" type="checkbox" onClick="showSpicSetting()"/>生成缩略图</label>
						</p>
						
						<p class="m3d" id="spicsetting" style="display:none">
							缩略图宽：<input id="swidth" class="text" name="swidth" value="" />
							缩略图高：<input id="sheight" class="text" name="sheight" value="" />
						</p-->
						
						<p class="p1">( 注：可批量上传，建议上传图片尺寸为670pxx600px,格式为jpg或gif，宽度不得大于670px )</p>
					</div>
					<div class="mbtn">
						<input type="button" name="save" value="保存" onclick="checkForm()" />
					</div>
				</div>
				</form>
			</div>
		</div>
	</div>
	<div class="footer">
		#parse('/inc/copyright.htm')
		<p></p>
		<p></p>	
	</div>
</div>

<!---->
<div class="footer-wrapper">
	<div class="footer">
		#parse('/inc/nav.htm')
	</div>
</div>

<!---->
<div id="NavLeft"><a href="javascript:void(0)">Show</a></div>
<div id="NavRight"><a href="javascript:void(0)">Star</a></div>
</body>
</html>
